package com.kwz.common.ui;

import javax.swing.JRadioButton;

import com.kwz.common.IComparable;
import com.kwz.common.IContext;
import com.kwz.common.designpatterns.factory.BadContextException;
import com.kwz.common.ui.events.IUiEventDefinition;

/**
 * <p>
 * 				Classe encapsulant un bouton JRadioButton
 * </p> 
 *
 * @author Ldr
 */
public class UiJRadioButton extends UiJToggleButton implements IUiJRadioButton {

    // Statiques
    public static final IUiEventDefinition[] EVENTS_DEFS = new IUiEventDefinition[]{
            UI.CHAIN(UiJComponent.class)
    };
    
    /**
     * @throws BadContextException
     */
    public UiJRadioButton() throws BadContextException {
        this((IContext)null);
    }

    /**
     * @param button
     * @throws BadContextException
     */    
    public UiJRadioButton(JRadioButton button) throws BadContextException {
        this(createContextFromComponent(null, button));
    }

    /**
     * @param id
     * @param button
     * @throws BadContextException
     */
    public UiJRadioButton(IComparable id, JRadioButton button) throws BadContextException {
        this(createContextFromComponent(id, button));
    }

    /**
     * @param context
     * @throws BadContextException
     */
    public UiJRadioButton(IContext context) throws BadContextException {
        super(context);
    }
    
    // ----------------------------------- IUiComponent ---------------------------------
    /* (non-Javadoc)
     * @see com.kwz.common.ui.IUiComponent#getEventDefinitions()
     */
    public IUiEventDefinition[] getEventDefinitions() {
        return EVENTS_DEFS;
    }

    // ----------------------------------- IUiJRadioButton -------------------------
	
	/* (non-Javadoc)
	 * @see com.kwz.common.ui.IUiJRadioButton#getJRadioButton()
	 */
	public JRadioButton getJRadioButton() {
		return (JRadioButton)getComponent();
	}


}
